// For testing Vertex Texture Fetch performance.
precision highp float;

uniform mat4 MVP;

attribute vec3 position;
attribute vec2 t0_uv;

uniform sampler2D t0_sampler;
varying vec2 uv;

void main() {
  vec3 pos = position;
  // Do several texture fetches.
  float s0 = texture2D(t0_sampler, t0_uv).b;
  float s1 = texture2D(t0_sampler, t0_uv + vec2(1.0/256.0, 1.0/256.0)).g;
  float s2 = texture2D(t0_sampler, t0_uv + vec2(-1.0/256.0, 1.0/256.0)).r;
  // Change the vertex y position based on the texture samples.
  pos.y = (s0 + s1 - s2) * 0.10;
  gl_Position = MVP * vec4(pos, 1.0);
  uv = t0_uv;
}
